package day13;

public class Regex {
    public static void main(String[] args) {
        String regex1 = "\\w{4,16}";
        String regex2 = "\\d{17}[\\dxX]";
        String regex3 = "[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]";
        String str="370683200203032218";
        System.out.println(str.matches(regex2));
        System.out.println(str.matches(regex3));
        String str1="我要学学学学学编编编编编程程程程程";
        String regex4 = "(.)\\1+";
        System.out.println(str1.replaceAll(regex4, "$1"));
    }
}
